package controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import entity.Emp;

@Controller
@RequestMapping("/ajax")
public class AjaxController {
	
	@RequestMapping(value="/validateUsername",produces="text/plain;charset=utf-8")
	public @ResponseBody String validateUsername(String username){
		System.out.println(username);
		if("abc".equals(username)){
			return "用户名已存在";
		}
		return "用户名可用";
	}
	
	@RequestMapping("/getEmp")
	public @ResponseBody Emp getEmp(){
		Emp emp=new Emp();
		emp.setId(1);
		emp.setName("abc啊");
		emp.setPassword("123");
		emp.setEmail("a@a.com");
		return emp;
	}
	
	
	
	
	
	
	
}
